package com.dongdongshop.service.impl;

import com.dongdongshop.mapper.TbContentCategoryMapper;
import com.dongdongshop.pojo.TbContentCategory;
import com.dongdongshop.pojo.TbContentCategoryExample;
import com.dongdongshop.service.TbcontentCateService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

//广告类型
@Service
@DubboService
public class TbcontentCateServiceimpl implements TbcontentCateService {


    @Autowired
    TbContentCategoryMapper tccm;


    //查询全部
    @Override
    public List<TbContentCategory> getall() {
        return tccm.selectByExample(null);
    }


    //增加
    @Override
    public int addcate(TbContentCategory name) {
        return tccm.insert(name);
    }


    //回显
    @Override
    public TbContentCategory upbyid(Long id) {
        return tccm.selectByPrimaryKey(id);
    }


    //修改
    @Override
    public int updatecate(TbContentCategory tc) {
        return tccm.updateByPrimaryKey(tc);
    }

    //删除
    @Override
    public int deletearr(List<Long> arrs) {
        TbContentCategoryExample te=new TbContentCategoryExample();
        TbContentCategoryExample.Criteria criteria = te.createCriteria();
        criteria.andIdIn(arrs);
        return tccm.deleteByExample(te);
    }


}
